# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


# NOTE: This class is auto generated by the swagger code generator program.
# https://github.com/swagger-api/swagger-codegen.git
# Do not edit the class manually.

defmodule GoogleApi.PlayMoviesPartner.V1.Api.Accounts do
  @moduledoc """
  API calls for all endpoints tagged `Accounts`.
  """

  alias GoogleApi.PlayMoviesPartner.V1.Connection
  import GoogleApi.PlayMoviesPartner.V1.RequestBuilder


  @doc """
  Get an Avail given its avail group id and avail id.

  ## Parameters

  - connection (GoogleApi.PlayMoviesPartner.V1.Connection): Connection to server
  - account_id (String): REQUIRED. See _General rules_ for more information about this field.
  - avail_id (String): REQUIRED. Avail ID.
  - opts (KeywordList): [optional] Optional parameters
    - :access_token (String): OAuth access token.
    - :key (String): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :quota_user (String): Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
    - :pp (Boolean): Pretty-print response.
    - :bearer_token (String): OAuth bearer token.
    - :oauth_token (String): OAuth 2.0 token for the current user.
    - :upload_protocol (String): Upload protocol for media (e.g. \&quot;raw\&quot;, \&quot;multipart\&quot;).
    - :pretty_print (Boolean): Returns response with indentations and line breaks.
    - :upload_type (String): Legacy upload protocol for media (e.g. \&quot;media\&quot;, \&quot;multipart\&quot;).
    - :fields (String): Selector specifying which fields to include in a partial response.
    - :__/xgafv (String): V1 error format.
    - :callback (String): JSONP
    - :alt (String): Data format for response.

  ## Returns

  {:ok, %GoogleApi.PlayMoviesPartner.V1.Model.Avail{}} on success
  {:error, info} on failure
  """
  @spec playmoviespartner_accounts_avails_get(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, GoogleApi.PlayMoviesPartner.V1.Model.Avail.t} | {:error, Tesla.Env.t}
  def playmoviespartner_accounts_avails_get(connection, account_id, avail_id, opts \\ []) do
    optional_params = %{
      :"access_token" => :query,
      :"key" => :query,
      :"quotaUser" => :query,
      :"pp" => :query,
      :"bearer_token" => :query,
      :"oauth_token" => :query,
      :"upload_protocol" => :query,
      :"prettyPrint" => :query,
      :"uploadType" => :query,
      :"fields" => :query,
      :"$.xgafv" => :query,
      :"callback" => :query,
      :"alt" => :query
    }
    %{}
    |> method(:get)
    |> url("/v1/accounts/{accountId}/avails/{availId}", %{
         "accountId" => URI.encode_www_form(account_id),
         "availId" => URI.encode_www_form(avail_id)
       })
    |> add_optional_params(optional_params, opts)
    |> Enum.into([])
    |> (&Connection.request(connection, &1)).()
    |> decode(%GoogleApi.PlayMoviesPartner.V1.Model.Avail{})
  end

  @doc """
  List Avails owned or managed by the partner.  See _Authentication and Authorization rules_ and _List methods rules_ for more information about this method.

  ## Parameters

  - connection (GoogleApi.PlayMoviesPartner.V1.Connection): Connection to server
  - account_id (String): REQUIRED. See _General rules_ for more information about this field.
  - opts (KeywordList): [optional] Optional parameters
    - :access_token (String): OAuth access token.
    - :key (String): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :quota_user (String): Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
    - :pp (Boolean): Pretty-print response.
    - :bearer_token (String): OAuth bearer token.
    - :oauth_token (String): OAuth 2.0 token for the current user.
    - :upload_protocol (String): Upload protocol for media (e.g. \&quot;raw\&quot;, \&quot;multipart\&quot;).
    - :pretty_print (Boolean): Returns response with indentations and line breaks.
    - :upload_type (String): Legacy upload protocol for media (e.g. \&quot;media\&quot;, \&quot;multipart\&quot;).
    - :fields (String): Selector specifying which fields to include in a partial response.
    - :__/xgafv (String): V1 error format.
    - :callback (String): JSONP
    - :alt (String): Data format for response.
    - :alt_id (String): Filter Avails that match a case-insensitive, partner-specific custom id. NOTE: this field is deprecated and will be removed on V2; &#x60;alt_ids&#x60; should be used instead.
    - :studio_names (List[String]): See _List methods rules_ for info about this field.
    - :territories (List[String]): Filter Avails that match (case-insensitive) any of the given country codes, using the \&quot;ISO 3166-1 alpha-2\&quot; format (examples: \&quot;US\&quot;, \&quot;us\&quot;, \&quot;Us\&quot;).
    - :title (String): Filter that matches Avails with a &#x60;title_internal_alias&#x60;, &#x60;series_title_internal_alias&#x60;, &#x60;season_title_internal_alias&#x60;, or &#x60;episode_title_internal_alias&#x60; that contains the given case-insensitive title.
    - :page_token (String): See _List methods rules_ for info about this field.
    - :video_ids (List[String]): Filter Avails that match any of the given &#x60;video_id&#x60;s.
    - :page_size (Integer): See _List methods rules_ for info about this field.
    - :alt_ids (List[String]): Filter Avails that match (case-insensitive) any of the given partner-specific custom ids.
    - :pph_names (List[String]): See _List methods rules_ for info about this field.

  ## Returns

  {:ok, %GoogleApi.PlayMoviesPartner.V1.Model.ListAvailsResponse{}} on success
  {:error, info} on failure
  """
  @spec playmoviespartner_accounts_avails_list(Tesla.Env.client, String.t, keyword()) :: {:ok, GoogleApi.PlayMoviesPartner.V1.Model.ListAvailsResponse.t} | {:error, Tesla.Env.t}
  def playmoviespartner_accounts_avails_list(connection, account_id, opts \\ []) do
    optional_params = %{
      :"access_token" => :query,
      :"key" => :query,
      :"quotaUser" => :query,
      :"pp" => :query,
      :"bearer_token" => :query,
      :"oauth_token" => :query,
      :"upload_protocol" => :query,
      :"prettyPrint" => :query,
      :"uploadType" => :query,
      :"fields" => :query,
      :"$.xgafv" => :query,
      :"callback" => :query,
      :"alt" => :query,
      :"altId" => :query,
      :"studioNames" => :query,
      :"territories" => :query,
      :"title" => :query,
      :"pageToken" => :query,
      :"videoIds" => :query,
      :"pageSize" => :query,
      :"altIds" => :query,
      :"pphNames" => :query
    }
    %{}
    |> method(:get)
    |> url("/v1/accounts/{accountId}/avails", %{
         "accountId" => URI.encode_www_form(account_id)
       })
    |> add_optional_params(optional_params, opts)
    |> Enum.into([])
    |> (&Connection.request(connection, &1)).()
    |> decode(%GoogleApi.PlayMoviesPartner.V1.Model.ListAvailsResponse{})
  end

  @doc """
  Get an Order given its id.  See _Authentication and Authorization rules_ and _Get methods rules_ for more information about this method.

  ## Parameters

  - connection (GoogleApi.PlayMoviesPartner.V1.Connection): Connection to server
  - account_id (String): REQUIRED. See _General rules_ for more information about this field.
  - order_id (String): REQUIRED. Order ID.
  - opts (KeywordList): [optional] Optional parameters
    - :access_token (String): OAuth access token.
    - :key (String): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :quota_user (String): Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
    - :pp (Boolean): Pretty-print response.
    - :bearer_token (String): OAuth bearer token.
    - :oauth_token (String): OAuth 2.0 token for the current user.
    - :upload_protocol (String): Upload protocol for media (e.g. \&quot;raw\&quot;, \&quot;multipart\&quot;).
    - :pretty_print (Boolean): Returns response with indentations and line breaks.
    - :upload_type (String): Legacy upload protocol for media (e.g. \&quot;media\&quot;, \&quot;multipart\&quot;).
    - :fields (String): Selector specifying which fields to include in a partial response.
    - :__/xgafv (String): V1 error format.
    - :callback (String): JSONP
    - :alt (String): Data format for response.

  ## Returns

  {:ok, %GoogleApi.PlayMoviesPartner.V1.Model.Order{}} on success
  {:error, info} on failure
  """
  @spec playmoviespartner_accounts_orders_get(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, GoogleApi.PlayMoviesPartner.V1.Model.Order.t} | {:error, Tesla.Env.t}
  def playmoviespartner_accounts_orders_get(connection, account_id, order_id, opts \\ []) do
    optional_params = %{
      :"access_token" => :query,
      :"key" => :query,
      :"quotaUser" => :query,
      :"pp" => :query,
      :"bearer_token" => :query,
      :"oauth_token" => :query,
      :"upload_protocol" => :query,
      :"prettyPrint" => :query,
      :"uploadType" => :query,
      :"fields" => :query,
      :"$.xgafv" => :query,
      :"callback" => :query,
      :"alt" => :query
    }
    %{}
    |> method(:get)
    |> url("/v1/accounts/{accountId}/orders/{orderId}", %{
         "accountId" => URI.encode_www_form(account_id),
         "orderId" => URI.encode_www_form(order_id)
       })
    |> add_optional_params(optional_params, opts)
    |> Enum.into([])
    |> (&Connection.request(connection, &1)).()
    |> decode(%GoogleApi.PlayMoviesPartner.V1.Model.Order{})
  end

  @doc """
  List Orders owned or managed by the partner.  See _Authentication and Authorization rules_ and _List methods rules_ for more information about this method.

  ## Parameters

  - connection (GoogleApi.PlayMoviesPartner.V1.Connection): Connection to server
  - account_id (String): REQUIRED. See _General rules_ for more information about this field.
  - opts (KeywordList): [optional] Optional parameters
    - :access_token (String): OAuth access token.
    - :key (String): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :quota_user (String): Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
    - :pp (Boolean): Pretty-print response.
    - :bearer_token (String): OAuth bearer token.
    - :oauth_token (String): OAuth 2.0 token for the current user.
    - :upload_protocol (String): Upload protocol for media (e.g. \&quot;raw\&quot;, \&quot;multipart\&quot;).
    - :pretty_print (Boolean): Returns response with indentations and line breaks.
    - :upload_type (String): Legacy upload protocol for media (e.g. \&quot;media\&quot;, \&quot;multipart\&quot;).
    - :fields (String): Selector specifying which fields to include in a partial response.
    - :__/xgafv (String): V1 error format.
    - :callback (String): JSONP
    - :alt (String): Data format for response.
    - :page_token (String): See _List methods rules_ for info about this field.
    - :custom_id (String): Filter Orders that match a case-insensitive, partner-specific custom id.
    - :video_ids (List[String]): Filter Orders that match any of the given &#x60;video_id&#x60;s.
    - :page_size (Integer): See _List methods rules_ for info about this field.
    - :pph_names (List[String]): See _List methods rules_ for info about this field.
    - :status (List[String]): Filter Orders that match one of the given status.
    - :studio_names (List[String]): See _List methods rules_ for info about this field.
    - :name (String): Filter that matches Orders with a &#x60;name&#x60;, &#x60;show&#x60;, &#x60;season&#x60; or &#x60;episode&#x60; that contains the given case-insensitive name.

  ## Returns

  {:ok, %GoogleApi.PlayMoviesPartner.V1.Model.ListOrdersResponse{}} on success
  {:error, info} on failure
  """
  @spec playmoviespartner_accounts_orders_list(Tesla.Env.client, String.t, keyword()) :: {:ok, GoogleApi.PlayMoviesPartner.V1.Model.ListOrdersResponse.t} | {:error, Tesla.Env.t}
  def playmoviespartner_accounts_orders_list(connection, account_id, opts \\ []) do
    optional_params = %{
      :"access_token" => :query,
      :"key" => :query,
      :"quotaUser" => :query,
      :"pp" => :query,
      :"bearer_token" => :query,
      :"oauth_token" => :query,
      :"upload_protocol" => :query,
      :"prettyPrint" => :query,
      :"uploadType" => :query,
      :"fields" => :query,
      :"$.xgafv" => :query,
      :"callback" => :query,
      :"alt" => :query,
      :"pageToken" => :query,
      :"customId" => :query,
      :"videoIds" => :query,
      :"pageSize" => :query,
      :"pphNames" => :query,
      :"status" => :query,
      :"studioNames" => :query,
      :"name" => :query
    }
    %{}
    |> method(:get)
    |> url("/v1/accounts/{accountId}/orders", %{
         "accountId" => URI.encode_www_form(account_id)
       })
    |> add_optional_params(optional_params, opts)
    |> Enum.into([])
    |> (&Connection.request(connection, &1)).()
    |> decode(%GoogleApi.PlayMoviesPartner.V1.Model.ListOrdersResponse{})
  end

  @doc """
  Get a StoreInfo given its video id and country.  See _Authentication and Authorization rules_ and _Get methods rules_ for more information about this method.

  ## Parameters

  - connection (GoogleApi.PlayMoviesPartner.V1.Connection): Connection to server
  - account_id (String): REQUIRED. See _General rules_ for more information about this field.
  - video_id (String): REQUIRED. Video ID.
  - country (String): REQUIRED. Edit country.
  - opts (KeywordList): [optional] Optional parameters
    - :access_token (String): OAuth access token.
    - :key (String): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :quota_user (String): Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
    - :pp (Boolean): Pretty-print response.
    - :bearer_token (String): OAuth bearer token.
    - :oauth_token (String): OAuth 2.0 token for the current user.
    - :upload_protocol (String): Upload protocol for media (e.g. \&quot;raw\&quot;, \&quot;multipart\&quot;).
    - :pretty_print (Boolean): Returns response with indentations and line breaks.
    - :upload_type (String): Legacy upload protocol for media (e.g. \&quot;media\&quot;, \&quot;multipart\&quot;).
    - :fields (String): Selector specifying which fields to include in a partial response.
    - :__/xgafv (String): V1 error format.
    - :callback (String): JSONP
    - :alt (String): Data format for response.

  ## Returns

  {:ok, %GoogleApi.PlayMoviesPartner.V1.Model.StoreInfo{}} on success
  {:error, info} on failure
  """
  @spec playmoviespartner_accounts_store_infos_country_get(Tesla.Env.client, String.t, String.t, String.t, keyword()) :: {:ok, GoogleApi.PlayMoviesPartner.V1.Model.StoreInfo.t} | {:error, Tesla.Env.t}
  def playmoviespartner_accounts_store_infos_country_get(connection, account_id, video_id, country, opts \\ []) do
    optional_params = %{
      :"access_token" => :query,
      :"key" => :query,
      :"quotaUser" => :query,
      :"pp" => :query,
      :"bearer_token" => :query,
      :"oauth_token" => :query,
      :"upload_protocol" => :query,
      :"prettyPrint" => :query,
      :"uploadType" => :query,
      :"fields" => :query,
      :"$.xgafv" => :query,
      :"callback" => :query,
      :"alt" => :query
    }
    %{}
    |> method(:get)
    |> url("/v1/accounts/{accountId}/storeInfos/{videoId}/country/{country}", %{
         "accountId" => URI.encode_www_form(account_id),
         "videoId" => URI.encode_www_form(video_id),
         "country" => URI.encode_www_form(country)
       })
    |> add_optional_params(optional_params, opts)
    |> Enum.into([])
    |> (&Connection.request(connection, &1)).()
    |> decode(%GoogleApi.PlayMoviesPartner.V1.Model.StoreInfo{})
  end

  @doc """
  List StoreInfos owned or managed by the partner.  See _Authentication and Authorization rules_ and _List methods rules_ for more information about this method.

  ## Parameters

  - connection (GoogleApi.PlayMoviesPartner.V1.Connection): Connection to server
  - account_id (String): REQUIRED. See _General rules_ for more information about this field.
  - opts (KeywordList): [optional] Optional parameters
    - :access_token (String): OAuth access token.
    - :key (String): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :quota_user (String): Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
    - :pp (Boolean): Pretty-print response.
    - :bearer_token (String): OAuth bearer token.
    - :oauth_token (String): OAuth 2.0 token for the current user.
    - :upload_protocol (String): Upload protocol for media (e.g. \&quot;raw\&quot;, \&quot;multipart\&quot;).
    - :pretty_print (Boolean): Returns response with indentations and line breaks.
    - :upload_type (String): Legacy upload protocol for media (e.g. \&quot;media\&quot;, \&quot;multipart\&quot;).
    - :fields (String): Selector specifying which fields to include in a partial response.
    - :__/xgafv (String): V1 error format.
    - :callback (String): JSONP
    - :alt (String): Data format for response.
    - :countries (List[String]): Filter StoreInfos that match (case-insensitive) any of the given country codes, using the \&quot;ISO 3166-1 alpha-2\&quot; format (examples: \&quot;US\&quot;, \&quot;us\&quot;, \&quot;Us\&quot;).
    - :name (String): Filter that matches StoreInfos with a &#x60;name&#x60; or &#x60;show_name&#x60; that contains the given case-insensitive name.
    - :studio_names (List[String]): See _List methods rules_ for info about this field.
    - :season_ids (List[String]): Filter StoreInfos that match any of the given &#x60;season_id&#x60;s.
    - :video_ids (List[String]): Filter StoreInfos that match any of the given &#x60;video_id&#x60;s.
    - :video_id (String): Filter StoreInfos that match a given &#x60;video_id&#x60;. NOTE: this field is deprecated and will be removed on V2; &#x60;video_ids&#x60; should be used instead.
    - :page_token (String): See _List methods rules_ for info about this field.
    - :page_size (Integer): See _List methods rules_ for info about this field.
    - :mids (List[String]): Filter StoreInfos that match any of the given &#x60;mid&#x60;s.
    - :pph_names (List[String]): See _List methods rules_ for info about this field.

  ## Returns

  {:ok, %GoogleApi.PlayMoviesPartner.V1.Model.ListStoreInfosResponse{}} on success
  {:error, info} on failure
  """
  @spec playmoviespartner_accounts_store_infos_list(Tesla.Env.client, String.t, keyword()) :: {:ok, GoogleApi.PlayMoviesPartner.V1.Model.ListStoreInfosResponse.t} | {:error, Tesla.Env.t}
  def playmoviespartner_accounts_store_infos_list(connection, account_id, opts \\ []) do
    optional_params = %{
      :"access_token" => :query,
      :"key" => :query,
      :"quotaUser" => :query,
      :"pp" => :query,
      :"bearer_token" => :query,
      :"oauth_token" => :query,
      :"upload_protocol" => :query,
      :"prettyPrint" => :query,
      :"uploadType" => :query,
      :"fields" => :query,
      :"$.xgafv" => :query,
      :"callback" => :query,
      :"alt" => :query,
      :"countries" => :query,
      :"name" => :query,
      :"studioNames" => :query,
      :"seasonIds" => :query,
      :"videoIds" => :query,
      :"videoId" => :query,
      :"pageToken" => :query,
      :"pageSize" => :query,
      :"mids" => :query,
      :"pphNames" => :query
    }
    %{}
    |> method(:get)
    |> url("/v1/accounts/{accountId}/storeInfos", %{
         "accountId" => URI.encode_www_form(account_id)
       })
    |> add_optional_params(optional_params, opts)
    |> Enum.into([])
    |> (&Connection.request(connection, &1)).()
    |> decode(%GoogleApi.PlayMoviesPartner.V1.Model.ListStoreInfosResponse{})
  end
end
